#include <gtest/gtest.h>

#include "SkipList.h"

TEST(SkipList, BasicTest) {
    auto skip_list = new skip_list::SkipList<std::string, std::string>(4);

    skip_list->insert_element("test1", "你好啊！");
    skip_list->insert_element("test5", "今天学习了跳表");
    skip_list->insert_element("test7", "跳表功能测试");
    skip_list->insert_element("test4", "测试结果");
    skip_list->insert_element("test6", "挺好的");

    std::string result;
    skip_list->search_element("test6", &result);
    std::cout << "测试结果：" << result << std::endl;

    skip_list->display_list();

    skip_list->delete_element("test7");

    skip_list->display_list();

    auto skip_str = skip_list->dump_file();

    auto skip_list_ = new skip_list::SkipList<std::string, std::string>(4);

    skip_list_->load_file(skip_str);

    skip_list_->display_list();
}
